import React, {Component} from 'react';
import Demo1 from "./ErrorBoundaries/Demo1";



class App extends Component {
    state ={
        hasError: false
    }


    static getDerivedStateFromError(error){
        return {state:true}
    }

    render() {
       if (this.state.hasError){
           return <Err/>
       }else{
           return <Demo1/>
       }
    }
}

export default App;


function Err(){
    return <h1>Error!</h1>
}

